<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">

<title>登录</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script src="jquery/jquery-3.1.1.js"></script>
<link rel="stylesheet" href="css/StyleSheet.css" type="text/css" />
<script type="text/javascript">
	function login() {
		var n = $("#username").val();
		var p = $("#password").val();
		if (n == "") {
			alert("用户名不允许为空!");
			return;
		}
		if (p == "") {
			alert("密码不允许为空!");
			return;
		}
		//实现异步请求
		$.ajax({
			type : "POST",
			url : "Login",
			data : {
				"user.loginname" : n,
				"user.loginpwd" : p
			},
			success : function(msg) {
				if (msg == "ok") {
					alert("登陆成功!");
					top.location.href = "index.jsp";
				} else {
					if (msg == "noexist") {
						alert("用户不存在!");
						return;
					}
					if (msg == "no") {
						alert("密码不正确!");
						return;
					}
				}
			},
			error : function(r, r2, err) {
				alert("连接错误:" + err.message);
			}
		});
	}
</script>
</head>
<body>
	<div>
		<ul>
			<li>
				<table width="60%" border="0" align="center" cellpadding="0"
					cellspacing="0">
					<tr>
						<td width="10"><img
							src="Images/az-tan-top-left-round-corner.gif"
							style="border: 0px; width:10px; height:18px" /></td>
						<td bgcolor="#DDDDCC" style="height: 18px;"><span
							style="font-family: '黑体'; font-size: 16px; color: #660000;">登录</span>
						</td>
						<td width="10"><img
							src="Images/az-tan-top-right-round-corner.gif"
							style="border: 0px; width:10px;height:18px" /></td>
					</tr>
				</table>

				<table width="60%" border="0" align="center" cellpadding="0"
					cellspacing="0" id="tblsecend">
					<tr>
						<td bgcolor="#DDDDCC" style="width: 2px">&nbsp;</td>
						<td>
							<div align="center">
								<table height="61" cellpadding="0" cellspacing="0">
									<tr>
										<td height="33" colspan="6">
											<p
												style="font-size: 14px; font-weight: bold; color: #FF9900;">
												已注册用户请从这里登录</p></td>
									</tr>
									<tr>
										<td width="24%" height="26" rowspan="2" align="right"
											valign="top"><strong class="contentColor">用户名：</strong>
										</td>
										<td valign="top" width="37%">&nbsp;<input type="text"
											class="input1" id="username" /></td>
									</tr>
								</table>
								<table height="61" cellpadding="0" cellspacing="0">
									<tr>
										<td height="1" colspan="6"></td>
									</tr>
									<tr>
										<td width="24%" height="26" rowspan="2" align="right"
											valign="top"><strong class="contentColor">密 码：</strong>
										</td>
										<td valign="top" width="37%">&nbsp;<input type="password"
											class="input1" id="password" /></td>
									</tr>
								</table>
								<div>
									<a href="javascript:;" onclick="login()"><input
										type="image" src="Images/az-login-gold-3d.gif"
										style="border-width:0px;" />
									</a> <a href="register.jsp" target="Iframe"><img
										src="Images/az-newuser-gold-3d.gif" alt=""
										style="border-width:0px;" />
									</a>
								</div>
								<div>
									<div align="center">&nbsp;</div>
								</div>
							</div></td>
						<td width="2" bgcolor="#DDDDCC">&nbsp;</td>
					</tr>
				</table>
				<table width="60%" height="3px" border="0" align="center"
					cellpadding="0" cellspacing="0">
					<tr align="center">
						<td height="3px" bgcolor="#DDDDCC">&nbsp;</td>
					</tr>
				</table></li>
		</ul>
	</div>
</body>

</html>
